import pickle

# 读取pickle文件
with open('Q_table_dict.pkl', 'rb') as file:
    Q_table_dict = pickle.load(file)

# 将Q_table_dict转换为字符串格式
Q_table_dict_str = str(Q_table_dict)

# 将字符串写入txt文件
with open('Q_table_dict.txt', 'w') as file:
    file.write(Q_table_dict_str)

print("Q_table_dict.pkl 已成功转换为 Q_table_dict.txt")
